<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
	
	
	xmlns:fmt="http://xmlns.jcp.org/jsp/jstl/fmt"
	xmlns:mywidgets="http://xmlns.jcp.org/jsf/composite/widgets">

<ui:composition template="/templates/contentTemplate.xhtml">

	#{pubThreadController.init}
	<ui:define name="title">#{pubThreadController.name}</ui:define>


	<ui:define name="navReferences">
		<c:if test="#{not empty pubThreadController.pubThreadsOfSameCategory}">
			<ui:decorate
				template="/templates/decorators/navReferenceDecorator.xhtml">

				<ui:define name="title">Other Threads of this Category</ui:define>

				<ui:define name="content">					
						<ui:repeat var="thread"
							value="#{pubThreadController.pubThreadsOfSameCategory}">
							<h:outputLink value="thread.jsf?tid=#{thread.id}" >#{thread.name}</h:outputLink><br/>
						</ui:repeat>					
				</ui:define>
			</ui:decorate>
		</c:if>
	</ui:define>


	<ui:define name="body">
		<div class="thread">
			<h1>#{pubThreadController.name} thread</h1>
			<div class="pubs">
				<ui:repeat var="pub" value="#{pubThreadController.relatedPubs}"
					varStatus="state" step="1" offset="0">
					#{pubController.init(pub.id)}
					<div class="pubTimebox">
						<h:outputText value="#{pubController.dateCreated}"
							styleClass="time">
							<f:convertDateTime pattern="hh:mm" type="date" />
						</h:outputText>
						<h:outputText value="#{pubController.dateCreated}"
							styleClass="date">
							<f:convertDateTime pattern="MMMM d yyyy" type="date" />
						</h:outputText>
					</div>
					<div id="pub_#{state.index}" class="pub_odd_#{state.odd}">
						<h:outputLink value="publication.jsf">
							<f:param name="pubId" value="#{pubController.id}" />
							<mywidgets:tileMidPictureTitleTeaser pubId="#{pubController.id}"
								isVerticalStacked="false"
								rendered="#{pubController.severityLevel >= 3}" />

							<mywidgets:tileSmallPictureTitle pubId="#{pubController.id}"
								isVerticalStacked="false"
								rendered="#{pubController.severityLevel == 2 and pubController.headerImageAvailable}" />

							<mywidgets:tileSmallTitle pubId="#{pubController.id}"
								rendered="#{pubController.severityLevel == 1 or (pubController.severityLevel == 2 and !pubController.headerImageAvailable)}" />
						</h:outputLink>

						<mywidgets:pubIcons pubId="#{pubController.id}" />

						<script>
						// append the script to the div
						$("#pubIcons_#{pubController.id}").appendTo("#details_#{pubController.id}");
						</script>
					</div>
				</ui:repeat>
			</div>

		</div>

	</ui:define>
</ui:composition>
</html>
